package sessions;

import java.sql.Date;
import java.util.List;

import javax.ejb.Remote;

import entities.Admin;
import entities.Skill;
import entities.User;
import exceptions.AdminAuthenticationException;
import exceptions.AuthenticationException;
import exceptions.DuplicatedUsernameException;

@Remote
public interface UserManagerRemote {

	/**
	 * @param username
	 * @param password
	 * @param email
	 * @param name
	 * @param surname
	 * @param birth
	 * @param address
	 * @throws DuplicatedUsernameException
	 */
	public void register(String username, String password, String email,
			String name, String surname, Date birth, String address)
			throws DuplicatedUsernameException;

	/**
	 * @param username
	 * @param password
	 * @throws AdminAuthenticationException
	 */
	public void adminAuthenticate(String username, String password)
			throws AdminAuthenticationException;

	/**
	 * @param username
	 * @param password
	 * @throws AuthenticationException
	 */
	public void authenticate(String username, String password)
			throws AuthenticationException;

	/**
	 * @param username
	 * @param name
	 * @param surname
	 * @param address
	 *            TODO
	 * @return the list of users found
	 */
	public List<User> search(String username, String name, String surname,
			String address);

	/**
	 * @param username
	 * @param password
	 * @param email
	 * @param name
	 * @param surname
	 * @param birth
	 * @param address
	 */
	public void edit(String username, String password, String email,
			String name, String surname, Date birth, String address);

	/**
	 * @param username
	 * @return
	 */
	public User fetch(String username);

	/**
	 * @param username
	 * @return
	 */
	public Admin fetchAdmin(String username);

	/**
	 * @param username
	 * @return
	 */
	public List<Skill> fetchDeclaredSkills(String username);

	/**
	 * @param username
	 */
	public void removeAllDeclaredSkills(String username);

	/**
	 * @param user
	 * @param skill
	 */
	public void declareSkill(User user, Skill skill);

}
